FROM ghcr.m.daocloud.io/livebook-dev/livebook:latest-cuda11.8

ENV LIVEBOOK_APP_SERVICE_NAME "🐳 Gitee AI - $SPACE_TITLE"
ENV LIVEBOOK_APP_SERVICE_URL "https://ai.gitee.com/apps/$SPACE_AUTHOR_NAME/$SPACE_REPO_NAME"
ENV LIVEBOOK_UPDATE_INSTRUCTIONS_URL "https://livebook.dev"
ENV LIVEBOOK_WITHIN_IFRAME "true"
ENV LIVEBOOK_APPS_PATH "/public-apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual"
ENV LIVEBOOK_DATA_PATH "/app/data"
ENV LIVEBOOK_HOME "/home/user"
ENV LIVEBOOK_PORT 7860
ENV HTTP_PROXY "$HTTP_PROXY"
ENV HTTPS_PROXY "$HTTP_PROXY"

EXPOSE 7860

# The Space container runs with user ID 1000
# RUN useradd -m -u 1000 user
ENV HOME=/home/user

USER root

RUN mkdir -p /home/user
RUN chmod 777 /home/user
RUN mkdir -p /app/data
RUN chmod 777 /app/data

COPY --chown=user public-apps/ /public-apps
RUN /app/bin/warmup_apps
